/**
 * 打开比赛
 * @param  {Object} game 比赛，其属性有：GAME_ID、GAME_NAME等直接从后台接口返回的信息
 * @return {[type]}      [description]
 */
export function openGame(game,vm) {
  // body...
  saveSessionGame(game);
  vm.$router.push({path: '/game/gamedetail',query:{gameId:game.GAME_ID}});
}

export function getSessionGame(gameId){
  var sGame = sessionStorage.getItem('game');
  if(sGame != null) {
    sGame = JSON.parse(sGame);
    if(sGame.GAME_ID == gameId) return sGame;
    else return null;
  }
  return sGame;
}

export function saveSessionGame(game){
  sessionStorage.setItem('game', JSON.stringify(game));
}